﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ue.Extensions
{
    public static class DateExtensions
    {
        #region GetMonthFirstDay and GetMonthLstDay

        public static DateTime GetMonthLastDay(this DateTime col)
        {
            if (col == DateTime.MinValue || col == DateTime.MaxValue)
            {
                return DateTime.MaxValue;
            }

            return new DateTime(col.Year,col.Month,DateTime.DaysInMonth(col.Year,col.Month));
        }

        public static DateTime GetMonthFirstDay(this DateTime col)
        {
            if (col == DateTime.MinValue || col == DateTime.MaxValue)
            {
                return DateTime.MinValue;
            }

            return new DateTime(col.Year, col.Month, 1);
        }

        #endregion
    }
}
